package com.nebula.salary.model.vo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.nebula.salary.model.pojo.Navigation;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serializable;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

/**
 * 角色编辑页面菜单显示类
 *
 * @author codex
 * @since 2022-02-24
 */
@ApiModel(value = "RoleMenuVo对象", description = "角色编辑页面菜单显示类")
public class RoleMenuVo implements Serializable {
    private static final long serialVersionUID = -5556138012765578381L;
    
    @ApiModelProperty(value = "菜单ID")
    private Integer navId;
    
    @ApiModelProperty(value = "菜单标题")
    private String label;
    
    @ApiModelProperty(value = "子菜单")
    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    private List<RoleMenuVo> children;
    
    public RoleMenuVo() {
    }
    
    public RoleMenuVo(Navigation navigation) {
        this.navId = navigation.getNavId();
        this.label = navigation.getItem();
        this.children = navigation.getChildren().stream().map(RoleMenuVo::new).collect(Collectors.toList());
    }
    
    public Integer getNavId() {
        return navId;
    }
    
    public void setNavId(Integer navId) {
        this.navId = navId;
    }
    
    public String getLabel() {
        return label;
    }
    
    public void setLabel(String label) {
        this.label = label;
    }
    
    public List<RoleMenuVo> getChildren() {
        return children;
    }
    
    public void setChildren(List<RoleMenuVo> children) {
        this.children = children;
    }
}
